package com.yilin.tms.data.components;


import com.yilin.tms.data.service.ITmsDataService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

@Service
public class DataServiceTimerTask {
    Logger logger = LoggerFactory.getLogger(DataServiceTimerTask.class);

    @Resource
    ITmsDataService tmsDataService;


    /**
     * 定时任务 车辆信息单
     */
    @Scheduled(fixedDelay = 10*60*1000)
    public void autoTmseVehicle() {
        try {
            tmsDataService.autoSaveVehicleOrder();
        } catch (Exception e) {
            logger.error("定时任务 车辆信息单 执行失败！" + e.getMessage());
        }
    }
    /**
     * 定时任务 驾驶员信息单
     */
    @Scheduled(fixedDelay = 10*60*1000)
    public void autoTmseDriverOrder() {
        try {
            tmsDataService.autoSaveDriverOrder();
        } catch (Exception e) {
            logger.error("定时任务 驾驶员信息单 执行失败！" + e.getMessage());
        }
    }
    /**
     * 定时任务 运单信息单
     */
    @Scheduled(fixedDelay = 10*60*1000)
    public void autoTmsTransit() {
        try {
            tmsDataService.autoSaveTransitOrder();
        } catch (Exception e) {
            logger.error("定时任务 运单信息单 执行失败！" + e.getMessage());
        }
    }
//    /**
//     * 定时任务 挂车信息补传单
//     */
//    @Scheduled(fixedDelay = 10*60*1000)
//    public void autoTmsTrailer() {
//        try {
//            tmsDataService.autoSaveTransitTrailerOrder();
//        } catch (Exception e) {
//            logger.error("定时任务 挂车信息补传单 执行失败！" + e.getMessage());
//        }
//    }
    /**
     * 定时任务 资金流水单
     */
    @Scheduled(fixedDelay = 10*60*1000)
    public void autoTmsCapitalFlowOrder() {
        try {
            tmsDataService.autoSaveCapitalFlowOrder();
        } catch (Exception e) {
            logger.error("定时任务 资金流水单 执行失败！" + e.getMessage());
        }
    }


}
